import { call, put, takeEvery, takeLatest } from 'redux-saga/effects'
import * as Api from '../api'
function* fetchUser(action) {
   try {
      const data = [{
          value: '这是saga'
      }]
      yield put({type: "addListdefault-saga", value: data});
   } catch (e) {
   }
}

function* setchUser(action) {
    try {
       yield put({type: "clearListdefault-saga",value:[]});
    } catch (e) {
       yield put({type: "clearListdefault-saga", value:[]});
    }
 }

function* mySaga() {
    //takeEvery表示捕获action的类型，然后去执行fetchUser的函数
  yield takeEvery("getList-saga", fetchUser);
  yield takeEvery("setList-saga", setchUser);
}
export default mySaga;